import javax.naming.NameNotFoundException;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Scanner;

class Password extends Exception {
    public Password(String password) {
        super(password);
    }
}
class Name extends Exception {
    public Name(String name) {
        super(name);
    }
}

public class Test3 {
    public static void Login (String name,String password) throws Password,Name{
        String rightN = "abcd";
        String rightP = "12346";
        if (!rightN.equals(name)) {
            throw new Name("用户名输入错误");
        }

        if (!rightP.equals(password)) {
            throw new Password("密码输入错误");
        }
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String name = scanner.nextLine();
        System.out.println("请输入密码：");
        String password = scanner.nextLine();
        try {
            Login(name,password);
        } catch (Password e) {
            System.out.println(e);
        } catch (Name e) {
            System.out.println(e);
        }
        int[] rr = {1,2,3,4};
        Arrays.sort(rr);
        System.out.println(rr[rr.length - 1]);
        System.out.println();
    }
}
